





<div class="x-body">
    <div class="layui-form form_single" id="form" action="{:url()}" method="post">
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>标题
            </label>
            <div class="layui-input-block">
                <input type="text" id="username" name="title" onchange="this.value=this.value.substring(0, 30)" onkeydown="this.value=this.value.substring(0, 30)" onkeyup="this.value=this.value.substring(0, 30)"  required="" lay-verify="required"
                       autocomplete="off"  value="{$info['title']|default=''}" class="layui-input">
            </div>
            <div style="color: red !important;" class="layui-form-mid layui-word-aux">
                （限制30字符）
            </div>
        </div>

        <div class="layui-form-item">
            <label for="L_pass" class="layui-form-label">
                排序
            </label>
            <div class="layui-input-block">
                <input type="number" id="L_pass" name="sort"
                       autocomplete="off" class="layui-input"  value="{$info['sort']|default=''}">
            </div>
            <div class="layui-form-mid layui-word-aux">
                (排序越大，顺序越前,默认0)
            </div>
        </div>


        <div class="layui-form-item">
            <label for="pid" class="layui-form-label">
                <span class="x-red">*</span>分类
            </label>
            <div class="layui-input-block">
                <select name="cate_id"  id="pid">
                    {volist name='banner_category_list' id='vo'}
                    <option value="{$vo['id']}" {notempty name="info['cate_id']"}{if condition="$info['cate_id'] eq $vo['id']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                    {/volist}
                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                (文章分类)
            </div>

        </div>

        <div class="layui-form-item">
            <label for="logo" class="layui-form-label">
                <span class="x-red">*</span>banner图片
            </label>
            <div id="logo" class="layui-input-block">
                {assign name="cover_id" value="$info.cover_id|default='0'" /}
                {:widget('file/index', ['name' => 'cover_id', 'value' => $cover_id, 'type' => 'img'])}
            </div>
            <!--<div class="layui-form-mid layui-word-aux">-->
            <!--(请上传单张封面图片)-->
            <!--</div>-->
        </div>


        <div class="layui-form-item">
            <label for="pid" class="layui-form-label">
                <span class="x-red">*</span>外链或者内链
            </label>
            <div class="layui-input-block">
                <select name="type" lay-filter="aihao">
                    <option value="5" {notempty name="info['type']"}{if condition="$info['type'] eq 5"} selected="selected" {/if}{/notempty} >店铺申请</option>
                    <option value="4" {notempty name="info['type']"}{if condition="$info['type'] eq 4"} selected="selected" {/if}{/notempty} >赌王申请</option>
                    <option value="3" {notempty name="info['type']"}{if condition="$info['type'] eq 3"} selected="selected" {/if}{/notempty} >赌王详情</option>
                    <option value="2" {notempty name="info['type']"}{if condition="$info['type'] eq 2"} selected="selected" {/if}{/notempty} >文章详情</option>
                    <option value="1" {notempty name="info['type']"}{if condition="$info['type'] eq 1"} selected="selected" {/if}{/notempty} >外链链接</option>

                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                (外链或者内链)
            </div>

        </div>
        <div class="layui-form-item" id="video"  {if condition="isset($info) && $info['type'] eq 1"} style="display: none;{/if}  >
            <label class="layui-form-label">
             赌王ID
              </label>
            <div class="layui-input-block">
                <input type="number" name="news_id"
                       autocomplete="number" class="layui-input"  value="{$info['news_id']|default=''}">
            </div>
            <div class="layui-form-mid layui-word-aux">
                (赌王ID)
            </div>
        </div>

        <div class="layui-form-item" id="video_url"  {if condition="isset($info) && $info['type'] eq 2"} style="display: none;{/if}  >
            <label class="layui-form-label">
            外链链接
            </label>
            <div class="layui-input-block">
                <input type="text" name="url"
                       autocomplete="text" class="layui-input"  value="{$info['url']|default=''}">
            </div>
            <div class="layui-form-mid layui-word-aux">
                (外链链接)
            </div>
        </div>













        <div class="box-footer">
            <input type="hidden" name="type" value="{:input('type')}"/>
            <input type="hidden" name="id" value="{$info['id']|default='0'}"/>

            {include file="layout/edit_btn_group"/}

        </div>

</form>
</div>

<script>
    layui.use('form', function(){
        var form = layui.form;

        form.on('select(aihao)', function(data){
            console.log(data.elem); //得到select原始DOM对象
            console.log(data.value); //得到被选中的值
            console.log(data.othis); //得到美化后的DOM对象
            if(data.value==1){
                $('#video_url').show();
                $('#video').hide();
            }else{

                $('#video_url').hide();
                $('#video').show();
            }

            form.render(null, 'form');
        });


    });


    function changevideo(v) {
        if(v==1){
            $('#video').show();
            $('#video_url').hide();
        }else{
            $('#video_url').show();
            $('#video').hide();
        }
    }
</script>
